const App = getApp()
Component({
  properties: {
    visible: Boolean, // 显示隐藏
    time:Number,
    startNow:Number
  },
  data:{
    redtimeout:'',
    time:0
  },
  attached(){
    
  },
  methods: {
    //倒计时
    timeout:function(){
        const self = this;
        //生成红包
        // self.rain();
        self.data.redtimeout = setInterval(function(){
          if(self.properties.time == 0){
            clearInterval(self.data.redtimeout);
            self.setData({
              visible:false
            })
           setTimeout(() => {
            wx.redirectTo({
              url: '/pages/marketing/packetrain/index?startNow='+self.properties.startNow
             })
           }, 500);
            //红包掉落
            // self.redpacket()
          }else{
            self.properties.time -= 1
            self.setData({
              time:self.properties.time
            })
          }
          
        },1000)
    }
  }
})